<template>
    <div class="de-result-time-select detect-box">
        <div class="headline flex-items">
            <div style="margin-left: 30px;">本机:</div>
            <el-select v-model="query.query" class="detect-search" style="width: 200px; margin: 0 10px;"
                placeholder="Select" size="large">
                <el-option label="禁用" :value="0" />
                <el-option label="启用" :value="1" />
            </el-select>

            <div>对方:</div>

            <el-select v-model="query.query" class="detect-search" style="width: 200px; margin: 0 10px;"
                placeholder="Select" size="large">
                <el-option label="禁用" :value="0" />
                <el-option label="启用" :value="1" />
            </el-select>


            <div style="margin-left: 30px;">始时:</div>
            <el-select v-model="query.query" class="detect-search" style="width: 200px; margin: 0 10px;"
                placeholder="Select" size="large">
                <el-option label="禁用" :value="0" />
                <el-option label="启用" :value="1" />
            </el-select>

            <img src="@/assets/img/lij1.png" style="height: 10px;width: 30px;margin-right: 10px;" />
            <div>终时:</div>

            <el-select v-model="query.query" class="detect-search" style="width: 200px; margin: 0 10px;"
                placeholder="Select" size="large">
                <el-option label="禁用" :value="0" />
                <el-option label="启用" :value="1" />
            </el-select>

            <button class="oval-button" style="width: 180px; margin-left: 100px;">最优频率文件查询</button>


        </div>

        <div class="flex-s list-headline" v-show="isDetail">
            <div class="flex-left" style="margin-left: 30px;">本机到目标机名称最优时段文件的详情</div>
            <div class="flex-right cursor" style="margin-right: 30px;" @click="setIsDetail(false, null)">x</div>
        </div>

        <div class="list" :class="!isDetail ? 'list-is-detail' : 'list-no-detail'">
            <div class="list-el-table" v-show="!isDetail">
                <el-table :data="gridData" class="table-list">
                    <el-table-column property="date" label="Date" align="center" />
                    <el-table-column property="name" label="Name" align="center" />
                    <el-table-column property="address" label="Address" align="center" />
                    <el-table-column property="address" label="Address" align="center" />
                    <el-table-column property="address" label="操作" width="120" align="center">
                        <template #default="scope">
                            <img class="cursor" style="height: 20px;width: 20px;margin:0 5px;" src="@/assets/img/de2.png"
                                @click="setIsDetail(true, scope.row)" />
                            <img class="cursor" style="height: 20px;width: 20px;margin:0 5px;"
                                src="@/assets/img/delete7.png" />
                        </template>
                    </el-table-column>
                </el-table>
            </div>

            <div class="list-el-table" v-show="isDetail">
                <el-table :data="gridData" class="table-list">
                    <el-table-column property="date" label="Date" align="center" />
                    <el-table-column property="name" label="Name" align="center" />
                    <el-table-column property="address" label="Address" align="center" />
                    <el-table-column property="address" label="操作" width="120" align="center" :show-overflow-tooltip="true">
                        <template #default="scope">
                            <img class="cursor" style="height: 20px;width: 20px;margin:0 5px;"
                                @click="setPopup(true, scope.row)" src="@/assets/img/compile.png">
                            <img class="cursor" style="height: 20px;width: 20px;margin:0 5px;"
                                src="@/assets/img/delete7.png">
                        </template>
                    </el-table-column>
                </el-table>
            </div>
        </div>
        <div class="flex" style="margin-top:20px;">
            <div class="flex-left" style="margin-left: 20px; color: #9A9DAA;">共有{{ total }}项数据</div>
            <el-pagination class="flex-right" layout="prev, pager, next, jumper" style="margin-right: 50px;" :total="total"
                small />
        </div>


        <div class="popup-custom flex" v-show="popup">
            <div class="result-time-add flex-right">
                <div class="flex-s popup-headline">
                    <div class="flex-left text1 flex-items cursor" @click="setPopup(false, null)"><img
                            src="@/assets/img/right.png" style="width: 20px;height: 20px;" /> 返回</div>
                    <div class="flex-right text2">最优时段频率文件详情编辑or添加</div>
                </div>

                <div class="popup-row">
                    <el-row class="popup-row-li">
                        <el-col :span="3">
                            <div class="popup-title">时段:</div>
                        </el-col>
                        <el-col :span="9">
                            <div class="popup-input"> <el-select v-model="query.query" class="detect-search"
                                    style="width: 240px; margin: 0 10px;" placeholder="Select" size="large">
                                    <el-option label="禁用" :value="0" />
                                    <el-option label="启用" :value="1" />
                                </el-select></div>
                        </el-col>
                        <el-col :span="3">
                            <div class="popup-title">时间:</div>
                        </el-col>
                        <el-col :span="9">
                            <div class="popup-input"> <el-select v-model="query.query" class="detect-search"
                                    style="width: 240px; margin: 0 10px;" placeholder="Select" size="large">
                                    <el-option label="禁用" :value="0" />
                                    <el-option label="启用" :value="1" />
                                </el-select></div>
                        </el-col>
                    </el-row>
                    <el-row class="popup-row-li">
                        <el-col :span="3">
                            <div class="popup-title">本机状态:</div>
                        </el-col>
                        <el-col :span="9">
                            <div class="popup-input"> <el-select v-model="query.query" class="detect-search"
                                    style="width: 240px; margin: 0 10px;" placeholder="Select" size="large">
                                    <el-option label="禁用" :value="0" />
                                    <el-option label="启用" :value="1" />
                                </el-select></div>
                        </el-col>
                        <el-col :span="3">
                            <div class="popup-title">目标台站状态:</div>
                        </el-col>
                        <el-col :span="9">
                            <div class="popup-input"> <el-select v-model="query.query" class="detect-search"
                                    style="width: 240px; margin: 0 10px;" placeholder="Select" size="large">
                                    <el-option label="禁用" :value="0" />
                                    <el-option label="启用" :value="1" />
                                </el-select></div>
                        </el-col>
                    </el-row>
                    <el-row class="popup-row-li">
                        <el-col :span="3">
                            <div class="popup-title">本机GPS:</div>
                        </el-col>
                        <el-col :span="9">
                            <div class="popup-input"> <el-select v-model="query.query" class="detect-search"
                                    style="width: 240px; margin: 0 10px;" placeholder="Select" size="large">
                                    <el-option label="禁用" :value="0" />
                                    <el-option label="启用" :value="1" />
                                </el-select></div>
                        </el-col>
                        <el-col :span="3">
                            <div class="popup-title">目标GPS:</div>
                        </el-col>
                        <el-col :span="9">
                            <div class="popup-input"> <el-select v-model="query.query" class="detect-search"
                                    style="width: 240px; margin: 0 10px;" placeholder="Select" size="large">
                                    <el-option label="禁用" :value="0" />
                                    <el-option label="启用" :value="1" />
                                </el-select></div>
                        </el-col>
                    </el-row>
                    <el-row class="popup-row-li">
                        <el-col :span="3">
                            <div class="popup-title">距离:</div>
                        </el-col>
                        <el-col :span="9">
                            <div class="popup-input"> <el-select v-model="query.query" class="detect-search"
                                    style="width: 240px; margin: 0 10px;" placeholder="Select" size="large">
                                    <el-option label="禁用" :value="0" />
                                    <el-option label="启用" :value="1" />
                                </el-select></div>
                        </el-col>

                    </el-row>


                    <el-row class="popup-row-li">
                        <el-col :span="3">
                            <div class="popup-title frequency-title">最优频率:</div>
                        </el-col>
                        <el-col :span="21">
                            <div class="frequency-ul">
                                <div class="add-list">
                                    <el-scrollbar style="height: 200px;">
                                        <div class="add-button flex">
                                            <div class="add-li flex-items" v-for="(item, idx) in compile.array" :key="idx">
                                                <span class="flex-left">{{ item }}</span>
                                                <img class="flex-right" src="@/assets/img/close-circle-fill.png"
                                                    style="width: 20px;height: 20px;" @click="deleteCompile(idx)" />
                                            </div>
                                            <el-input v-show="compile.show" v-model="compile.num" class="add-input" style=""
                                                placeholder="输入字符" @keyup.enter="addInputChange" @blur="addInputChange"
                                                @input="handleInput"></el-input>
                                            <div class="add-li flex-s"
                                                style="background: #46E5CB;text-align: center; color: #036EB7;"
                                                @click="compile.show = true">
                                                +
                                            </div>
                                        </div>
                                    </el-scrollbar>
                                </div>
                            </div>
                        </el-col>

                    </el-row>
                </div>
                <div class="oval-button">保存</div>
            </div>


        </div>
    </div>
</template>
<script>

export default {
    name: "detectResult",
    data() {
        return {
            visibles: false,
            query: {
                local: null,
                other: null,
            },
            gridData: [
                { id: 1, name: "重庆方案1", frequency: [] }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" },
                { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" },
                { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" }, { id: 1, name: "重庆方案1" }, { id: 2, name: "重庆方案2" }, { id: 3, name: "重庆方案3" }, { id: 4, name: "重庆方案4" },
            ],
            total: 1000,
            isDetail: false,
            popup: false,
            compile: {
                visible: false,
                array: [3.32, 3.33, 3.34, 5.3],
                show: false,
                num: null,
            },
        }
    },
    watch: {

    },
    mounted() {

    },
    unmounted() {
    },
    methods: {
        setIsDetail(value, row) {
            if (value) {
                this.isDetail = true;
            } else {
                this.isDetail = false;
            }
        },
        setPopup(value, row) {
            if (value) {
                this.popup = true;
            } else {
                this.popup = false;
            }
        },
        addInputChange() {
            if (!(this.compile.num == null || this.compile.num == '')) {
                this.compile.array.push(this.compile.num);
                this.compile.num = null;
            }
            this.compile.show = false;
        },
        deleteCompile(index) {
            this.compile.array.splice(index, 1);
        },
        handleInput() {
            this.compile.num = this.compile.num.replace(/[^\d.]/g, ''); // 清除非数字和点
            this.compile.num = this.compile.num.replace(/^\./g, ''); // 首位不能是点
            this.compile.num = this.compile.num.replace(/\.{2,}/g, '.'); // 保证只有一个点
            this.compile.num = this.compile.num.replace('.', '$#$').replace(/\./g, '').replace('$#$', '.'); // 保证小数点只出现一次
            this.compile.num = this.compile.num.replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); // 保留两位小数
        },
    },
};
</script>
<style  lang="scss">
.de-result-time-select {
    // height: calc(100% - 80px);
    // width: calc(100% - 280px);
    background: linear-gradient(to right, #313B53, #272F43);

    .headline {
        width: 100%;
        height: 108px;
        background: linear-gradient(to right, #313B53, #272F43);
        color: #9A9DAA;
        font-size: 14px;

        .el-input__wrapper {
            background-color: #394760;
            border-radius: 50px;
            width: 267px;
            box-shadow: 0 0 0 0;
        }
    }


    .list-is-detail {
        height: calc(100% - 180px);
    }

    .list-no-detail {
        height: calc(100% - 230px);
    }

    .list-headline {
        width: 100%;
        height: 50px;
        color: #9A9DAA;
        font-weight: 700;
    }

    .list {
        background: linear-gradient(to right, #2C334C, #1D2435);

        .list-el-table {
            background: none;
            padding: 0 80px;
            height: calc(100%);

            .el-table {
                --el-table-border-color: none !important;
                --el-table-border: none;
                --el-table-bg-color: none !important;
                --el-table-header-text-color: hsl(223, 31%, 13%);
                --el-table-row-hover-bg-color: #171D2C;
                height: calc(100%);
            }

            .el-table .el-table__row td:first-child {
                border-radius: 50px 0 0 50px;
                padding: 2px;
                z-index: 999;
                padding-left: 20px;
            }

            /* //此代码是让每行右边侧变圆 */
            .el-table .el-table__row td:last-child {
                border-radius: 0 50px 50px 0;
                z-index: 999;
                padding: 2px;
            }

            .el-table tr {
                background-color: initial;
                color: #9A9DAA;
            }

            /* 偶数行 */
            .el-table .el-table__row:nth-child(odd) {
                background-color: #575D73;
                color: #9A9DAA;
            }

            .el-table .el-table__row {
                height: 50px;
            }

            .el-table th.el-table__cell {
                background: none;
                background-color: initial;
            }

            .el-table__row {
                border: none;
            }
        }
    }

    .popup-custom {
        //自定义弹出层蒙版
       
        .result-time-add {
            background: linear-gradient(to right, #2C334C, #1D2435);
            width: 811px;
            height: 100vh;

            .popup-headline {
                height: 40px;
                background: linear-gradient(to right, #313B53, #272F43);
                padding: 0 20px;

                .text1 {
                    color: #2CA6E0;
                }

                .text2 {
                    color: #9A9DAA;
                    font-weight: 700;
                }
            }

            .oval-button{
                position: absolute;
                bottom: 20px;  
                right: 20px;              
            }
        }

        .popup-row {
            padding: 40px;
            width: 100%;

            .popup-row-li {
                margin: 15px 0;

            }

            .popup-title {
                text-align: right;
                line-height: 40px;
                color: #9A9DAA;
            }

            // .popup-input {}
            .frequency-title {
                line-height: 80px;
            }

            .frequency-ul {
                width: 625px;
                min-height: 80px;
                background: #394760;
                border-radius: 20px;
                margin-left: 20px;

                .add-list {
                    .add-button {
                        width: 625px;
                        display: flex;
                        flex-wrap: wrap;

                        .add-li {
                            color: white;
                            width: 75px;
                            height: 35px;
                            background: #2B526F;
                            border-radius: 30px;
                            padding: 0 5px;
                            margin: 10px 5px;
                        }

                        .add-input {
                            border-radius: 30px;
                            width: 85px;
                            height: 35px;
                            margin: 10px 5px;
                            font-size: 12px;
                            font-size: 18px;
                        }
                        .el-input__wrapper{
                            border-radius: 30px;
                            background-color: #2B526F;
                            color: white;
                        }
                        .el-input__inner{
                            color: white;

                        }
                    }
                }

            }
           

        }
    }

}
</style>
  